<?php
include 'int.php';

if (isset($_COOKIE["login_session"]) && $_COOKIE["login_session"]!=""){		
	if ($stmt = $mysqlpdo->prepare("UPDATE join_game g SET g.joined=0, g.user='', g.session='', g.photo=0 WHERE g.session=?")) {
		$stmt->bindParam(1, $_COOKIE["login_session"], PDO::PARAM_STR);
		$stmt->execute();
		if ($stmt->rowCount()==0){
			echo "error";
			exit();
		}
		setcookie("login_session", "", time()-3600*3);
	}
}
header('Location: index.php');
?>